package br.server;

import java.rmi.RemoteException;

import br.common.Leilao;
import br.server.remoteobjects.RemoteSubjectImpl;

public class LeilaoImpl extends RemoteSubjectImpl implements Leilao {

	private int ultimoLance;
	
	public LeilaoImpl() throws RemoteException {
	}

	@Override
	public void lance(int a) throws RemoteException {
		System.out.println("Novo lance: " + a);
		this.setUltimoLance(a); 
		this.notifyObservers("atualizaLances");

	}

	@Override
	public int retornaUltimoLance() throws RemoteException {
		return this.getUltimoLance();
	}	
	//Essa regra de negocio de guardar o ultimo lance, deveria estar
	//em alguma classe do RN do servidor(classes do MA)
	public int getUltimoLance() {
		return ultimoLance;
	}

	public void setUltimoLance(int ultimoLance) {
		this.ultimoLance = ultimoLance;
	}


}
